import { confirm } from '../../../utils/api';

export default {
  namespace: 'confirm',
  state: {
    order: [],
    address: [],
    pay: 0
  },

  effects: {
    * getOrder({ payload }, { call, put }) {
      const result = yield call(confirm, {
        ...payload
      })

      console.log(result);
      yield put({
        type: 'updateState',
        payload: result
      })
    },
  },

  reducers: {
    updateState(state, { payload: order, payload: address, payload: pay }) {
      return { ...state, ...order, ...address, ...pay }
    },
  }

}
